<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // ## 2. 反转字符串
        // 要求结果
        // gfedcba

        var str = 'abcdefg'
        var str1 = str.split('').reverse()
        
        var str2 =str1.reduce(function(pre,cur){
            return pre += cur
        },'')
        
        console.log(str2)
    </script>
</body>
</html>